import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/home/index.vue";
import AboutView from "../views/about/index.vue";
import tableView from "../views/editable/index.vue";
import projectView from "../views/project/index.vue";
import wbsView from "../views/pm/wbs/index.vue";
import ConfigurationType from "../views/pm/ConfigurationType/index.vue";
import pmSettingLayout from "../views/pm/setting/layout/index.vue";
import pmGlobalSettingLayout from "../views/pm/globalSetting/layout/index.vue";
import pmSettingBaseInfo from "../views/pm/setting/baseInfo/index.vue";
import pmSettingMember from "../views/pm/setting/pmMember/index.vue";
import rolePermissions from "../views/pm/setting/rolePermissions/index.vue";
import pmFieldTemplate from "@/views/pm/globalSetting/pmFieldTemplate/index.vue";
import pmFieldTemplateDetail from "@/views/pm/globalSetting/pmFieldTemplate/detail.vue";
import taskFieldTemplate from "@/views/pm/globalSetting/taskFieldTemplate/index.vue";
import taskFieldTemplateDetail from "@/views/pm/globalSetting/taskFieldTemplate/detail.vue";
import pmRole from "@/views/pm/globalSetting/pmRole/index.vue";
import pmTemplate from "@/views/pm/globalSetting/pmTemplate/index.vue";
import pmTemplateDetail from "@/views/pm/globalSetting/pmTemplate/detail.vue";
import lifecycleManagement from "@/views/pm/globalSetting/globalLifecycle/index.vue";
import globalDetailLifecycle from "@/views/pm/globalSetting/globalLifecycle/lifecycleDetail.vue";
import taskType from "@/views/pm/globalSetting/taskType/index.vue";
import projectType from "@/views/pm/globalSetting/projectType/index.vue";
import projectTypeDetail from "@/views/pm/globalSetting/projectTypeDetail/index.vue";
import taskTypeDetail from "@/views/pm/globalSetting/taskTypeDetail/index.vue";
import baseFieldManagement from "@/views/pm/globalSetting/baseFieldManagement/index.vue";
import customFieldsTemplate from "@/views/pm/globalSetting/customFieldsTemplate/index.vue";
import customFieldTemplateDetail from "@/views/pm/globalSetting/customFieldTemplateDetail/index.vue";
import projectRecyclingBin from "@/views/pm/globalSetting/projectRecyclingBin/index.vue";
import projectArchive from "@/views/pm/globalSetting/projectArchive/index.vue";
import pmRoleDetail from "@/views/pm/globalSetting/pmRole/setPmRole.vue";
import projectLifecycle from "@/views/pm/setting/projectLifecycle/index.vue";

import taskView from "../views/task/index.vue";
import userLoadView from "../views/userLoad/index.vue";
import projectDocView from "../views/projectDoc/index.vue";

import calendarView from "../views/pm/calendar/index.vue";

import homeCustomView from "../views/homeCustom/index.vue";
import SubTaskView from "@/components/wbsDraw/SubTaskView.vue";

//demo
import demoView from "../views/demo/index.vue";
import demoTableWBSView from "../views/demo/wbs/index.vue";

const routes = [
  {
    path: "/calendar",
    name: "Calendar",
    component: calendarView,
  },
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "Home",
    component: HomeView,
  },
  {
    path: "/table",
    name: "table",
    component: tableView,
  },
  {
    path: "/design", // 公共配置
    name: "Design",
    component: () => import("../views/design/GlobalLayoutConfig.vue"),
  },
  {
    path: "/editor/:id/:state/:pageKey/:projectId?", // 编辑器
    name: "Editor",
    component: () => import("../views/design/Editor.vue"),
  },
  {
    path: "/report", // 报表页
    name: "Report",
    component: () => import("../views/report/index.vue"),
  },
  {
    path: "/wbs",
    name: "Wbs",
    component: wbsView,
  },
  {
    path: "/SubTaskView",
    name: "SubTaskView",
    component: SubTaskView,
  },
  {
    path: "/about",
    name: "About",
    component: AboutView,
  },
  {
    path: "/project",
    name: "Project",
    component: projectView,
  },
  {
    path: "/pm/wbs",
    name: "pm",
    component: wbsView,
  },
  {
    path: "/pm/ConfigurationType",
    name: "ConfigurationType",
    component: ConfigurationType,
  },
  {
    path: "/pm/setting",
    name: "pmSetting",
    component: pmSettingLayout,
    children: [
      {
        path: "baseInfo",
        name: "baseInfo",
        component: pmSettingBaseInfo,
      },
      {
        path: "pmMember",
        name: "pmMember",
        component: pmSettingMember,
      },
      {
        path: "rolePermissions",
        name: "rolePermissions",
        component: rolePermissions,
      },
      {
        path: "lifeCycle",
        name: "lifeCycle",
        component: projectLifecycle,
      },
      {
        path: "taskType",
        name: "taskType",
        component: pmSettingBaseInfo,
      },
      {
        path: "recycleBin",
        name: "recycleBin",
        component: pmSettingBaseInfo,
      },
    ],
  },
  {
    path: "/pm/globalSetting",
    name: "globalSetting",
    component: pmGlobalSettingLayout,
    children: [
      {
        path: "baseFieldManagement",
        name: "baseFieldManagement",
        component: baseFieldManagement,
      },
      {
        path: "pmFieldTemplate",
        name: "pmFieldTemplate",
        component: pmFieldTemplate,
      },
      {
        path: "pmFieldTemplateDetail",
        name: "pmFieldTemplateDetail",
        component: pmFieldTemplateDetail,
      },
      {
        path: "taskFieldTemplate",
        name: "taskFieldTemplate",
        component: taskFieldTemplate,
      },
      {
        path: "taskFieldTemplateDetail",
        name: "taskFieldTemplateDetail",
        component: taskFieldTemplateDetail,
      },
      {
        path: "pmRole",
        name: "pmRole",
        component: pmRole,
      },
      {
        path: "pmRoleDetail",
        name: "pmRoleDetail",
        component: pmRoleDetail,
      },
      {
        path: "pmTemplate",
        name: "pmTemplate",
        component: pmTemplate,
      },
      {
        path: "pmTemplateDetail",
        name: "pmTemplateDetail",
        component: pmTemplateDetail,
      },
      {
        path: "lifecycleManagement",
        name: "lifecycleManagement",
        component: lifecycleManagement,
      },
      {
        path: "lifecycleDetail",
        name: "lifecycleDetail",
        component: globalDetailLifecycle,
      },
      {
        path: "pmType",
        name: "pmType",
        component: projectType,
      },
      {
        path: "projectTypeDetail",
        name: "projectTypeDetail",
        component: projectTypeDetail,
      },
      {
        path: "taskType",
        name: "taskType",
        component: taskType,
      },
      {
        path: "taskTypeDetail",
        name: "taskTypeDetail",
        component: taskTypeDetail,
      },
      {
        path: "customFieldTemplate",
        name: "customFieldTemplate",
        component: customFieldsTemplate,
      },
      {
        path: "customFieldTemplateDetail",
        name: "customFieldTemplateDetail",
        component: customFieldTemplateDetail,
      },
      {
        path: "projectRecyclingBin",
        name: "projectRecyclingBin",
        component: projectRecyclingBin,
      },
      {
        path: "projectArchive",
        name: "projectArchive",
        component: projectArchive,
      },
    ],
  },
  {
    path: "/demo",
    name: "demo",
    component: demoView,
  },
  {
    path: "/demo/wbs",
    name: "demoWbs",
    component: demoTableWBSView,
  },
  {
    path: "/task",
    name: "task",
    component: taskView,
  },
  {
    path: "/userLoad",
    name: "userLoad",
    component: userLoadView,
  },
  {
    path: "/projectDoc",
    name: "projectDoc",
    component: projectDocView,
  },
  {
    path: "/homeCustom",
    name: "homeCustom",
    component: homeCustomView,
  },
];

const router = createRouter({
  history: createWebHistory("/sdm-app"),
  routes,
});

export default router;
